import objectBase
import time
from constant import *

class PlantBase(objectBase.ObjectBase):
    def __init__(self,surface,path,size,pos,gap,summonTime) :
        self.surface = surface
        self.gap = gap
        self.summonTime = summonTime
        self.summonStartTime = None
        super().__init__(path,size,pos)

    def grow(self) :
        self.draw(self.surface)
        self.updateFileIndex(self.gap)

    def checkSummon(self) :
        if self.summonStartTime is None:
            return True
        elif time.time() - self.summonStartTime > self.summonTime:
            self.summonStartTime = time.time()
            return True
        return False

    def summon(self):
        self.summonStartTime = time.time()
